package com.qf.dubbo.controller;


import com.qf.dubbo.service.DeviceService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("device")
public class DeviceController {

    @Reference(version = "default",loadbalance = "roundrobin",mock = "com.qf.dubbo.service.impl.MyDeviceMock",timeout = 1000)
    private DeviceService deviceService;




    @RequestMapping("/{id}")
    public String getDevice(@PathVariable("id") int id){
        System.out.println("consumer中getDevice方法被触发");
        return deviceService.showDevice(id);
    }


}
